//file: MessageBoard.java
import java.util.*;

public class MessageBoard extends Observable {
	private String message;

	public String getMessage(  )
	{
		return message;
	}

	public void changeMessage( String message )
	{
		this.message = message;
		setChanged();
		notifyObservers( message );
	}

	public static void main( String [] args )
	{
		MessageBoard board = new MessageBoard(  );
		Student bob = new Student("Bob");
		Student joe = new Student("Joe");
		board.addObserver( bob );
		board.addObserver( joe );
		board.changeMessage("More Homework!");
	}
} // end of class MessageBoard

class Student implements Observer {
	private String name;

	Student (String Name)
	{
		this.name = Name;
	}

	public void update(Observable o, Object arg)
	{
		System.out.println( this.name + ": Message board changed: " + arg );
	}
}
